#include <iostream>
#include "contacts.pb.h"
using namespace std;

int main()
{
    contacts::contact conn;
    conn.set_sn("123456");
    conn.set_name("张三");
    conn.set_score(99.99);


    string str = conn.SerializeAsString();
    cout << "序列化结果: " << str << endl;


    // 对结果进行反序列化
    contacts::contact c;
    c.ParseFromString(str);

    cout << "学生姓名：" << c.name() << endl << "学生学号：" << c.sn() << endl << "学生成绩：" << c.score() << endl;
    return 0;
}